
public class Triunghi implements Poligon
{
	private Punct a;
    private Punct b;
    private Punct c;
    public Triunghi(Punct a,Punct b,Punct c)
    {
    	this.a=a;
    	this.b=b;
    	this.c=c;
    }
    public double perimetru()
    //calcul perimetrului delegat clasei Punct
    {
    	return a.distanta(b)+b.distanta(c)+c.distanta(a);
    }
    public double arie()
    //analog dar pt arie
    {
    	double perimetru=this.perimetru()/2;
    	return Math.sqrt(perimetru*(perimetru-a.distanta(b))*(perimetru-b.distanta(c))*(perimetru-c.distanta(a)));
        }
    public String toString()
    {
    	return "Laturile triungiului sunt formate din" +
    			"punctele: "+a+" "+b+" "+c;
    }

}

